package me.firstapp.spi.system;

import java.util.Map;

import me.firstapp.common.json.ListObject;
import me.firstapp.common.json.PageObject;
import me.firstapp.common.json.SingleObject;
import me.firstapp.common.module.system.JsonApiClient;
import me.firstapp.common.module.system.JsonApiClientRecord;

public interface ApiClientService {

	/**
	 * 新增api客户
	 * 
	 * @param email
	 * @param description
	 * @return
	 */
	SingleObject<JsonApiClient> addApiClient(String email, String description);

	/**
	 * 更新api客户
	 * 
	 * @param id
	 * @param yesCounts
	 * @param description
	 * @param status
	 * @return
	 */
	SingleObject<JsonApiClient> updateApiClient(Long id, Long yesCounts, String description, Integer status);

	/**
	 * 分页查询api客户
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @param searchParams
	 * @param sortParam
	 * @param sortType
	 * @return
	 */
	PageObject<JsonApiClient> findApiClientPage(Integer pageNo, Integer pageSize, Map<String, Object> searchParams,
			String sortParam, String sortType);

	/**
	 * 查询api客户列表
	 * 
	 * @return
	 */
	ListObject<JsonApiClient> findAll();

	/**
	 * 分页查询api客户
	 * 
	 * @param apiClientId
	 * @param pageNo
	 * @param pageSize
	 * @param searchParams
	 * @param sortParam
	 * @param sortType
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	PageObject<JsonApiClientRecord> findJsonApiClientRecordPage(Long apiClientId, Integer pageNo, Integer pageSize,
			Map<String, Object> searchParams, String sortParam, String sortType, Long startTime, Long endTime);

	/**
	 * api客户访问记录新增
	 * 
	 * @param apiClientId
	 * @param dateTime
	 * @param counts
	 * @return
	 */
	SingleObject<JsonApiClientRecord> addApiClientRecord(Long apiClientId, Long dateTime, Long counts);

	/**
	 * 查询api客户访问总次数
	 * 
	 * @param apiClientId
	 * @return
	 */
	SingleObject<Long> findApiClientRecordTotalTimes(Long apiClientId);

	/**
	 * 查询api客户访问日平均次数
	 * 
	 * @param apiClientId
	 * @return
	 */
	SingleObject<Long> findApiClientRecordMeanTimes(Long apiClientId);
}
